

import 'package:flutter/cupertino.dart';
import 'package:flutter_book/config/application.dart';
import 'package:flutter_book/constant/color.dart';
import 'package:flutter_book/route/router.dart';
import 'package:flutter_book/widget/common/buttom_common.dart';
import 'package:get/get.dart';
import 'package:flutter_book/util/extensions/widget_extensions.dart';
import 'package:flutter_book/util/extensions/string_extensions.dart';

class PersonalPage extends StatefulWidget {
  @override
  _PersonalPageState createState() => _PersonalPageState();
}

class _PersonalPageState extends State<PersonalPage> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: AppColor.mainBlue,
      child: Center(
        child: _getBtnListUi(),
      ),
    );
  }

  Widget _getBtnListUi(){
    return Column(
      children: [
        ButtonCommonSwitch("debug_Dialog",onTap: _onClickListener, isOpen: Application.isDebugModeDialog, isShowSwitch: true),
        ButtonCommonSwitch("debug_toast",onTap: _onClickListener, isOpen: Application.isDebugModeToast, isShowSwitch: true),
        ButtonCommonSwitch("debug_log",onTap: _onClickListener, isOpen: Application.isDebugModeLog, isShowSwitch: true),
        ButtonCommonSwitch("测试",onTap:_onClickListener),
        ButtonCommonSwitch("资源",onTap:_onClickListener),
      ],
    );
  }

  //点击事件
  void _onClickListener(String title,[bool isOpen=false]) async {
    switch (title) {
      case "debug_Dialog":
        Application.isDebugModeDialog=isOpen;
        break;
      case "debug_toast":
        Application.isDebugModeToast=isOpen;
        break;
      case "debug_log":
        Application.isDebugModeLog=isOpen;
        break;
      case "资源":
        AppRouter.toBackstageHome();
        break;
      case "测试":
        "测试".toastD;
        AppRouter.toTestPage();
        break;
    }
  }

}
